<template>
    <div class="input-text">
        <input type="text" v-model="inputValue" @keyup.enter="doInput">
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { todoList } from './type';
const inputValue = ref<string>('')
const emit = defineEmits(['doInput'])// 接受方法
const doInput = () => {
    let obj: todoList = {
        id: new Date() + '',
        isShow: false,
        value: inputValue.value
    }
    inputValue.value = ''
    emit('doInput', obj)
}
</script>

<style scoped>
.input-text input {
    width: 90%;
    height: 30px;
}
</style>
